package com.example.springbootdeom.dao;

import com.example.springbootdeom.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Repository
//@Service
public interface UserDao {
    //登录
    @Select("select * from user where uname=#{name} and password =#{pwd}")
    public User login(@Param("name") String name,@Param("pwd") String pwd);

    //注册
    @Insert("INSERT INTO user2(username,password,major,birthday) VALUES(#{username},#{password},#{major},#{birthday}) ")
    public boolean regin(User user);

    //修改信息
    @Update("UPDATE user2 set username=#{username} password=#{password}  where id=3 ;")
    public boolean modify(User user);

    //根据用户查询
    @Select("select * from user where id=#{id}")
    public User getUser(Integer id);
}
